package org.springsource.dao.impl;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;
import org.springsource.dao.CategoryDao;
import org.springsource.domain.Category;

@Repository
public class CategoryDaoImpl implements CategoryDao {
	
	@PersistenceContext
	private EntityManager entityManager;
	
	@Override
	public Category getCategory(Long id) {
		return entityManager.find(Category.class, id);
	}

	@Override
	public Category saveCategory(Category category) {
		return entityManager.merge(category);
	}

}
